package com.gouaixin.bee.beeframework2.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.gouaixin.bee.beeframework2.R;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.ArrayList;

/**
 * Created by Administrator on 2015/3/30.
 */
public class GridViewAdapter extends BaseAdapter {

    Context context;
    ArrayList<String> datas = new ArrayList<String>();
    ImageLoader imageLoader;

    public GridViewAdapter(Context context) {
        this.context = context;
        imageLoader=ImageLoader.getInstance();

    }

    public void setData(ArrayList<String> data) {
        datas = data;
    }

    @Override
    public int getCount() {

        return datas.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        final ImageView mView = new ImageView(context);

        AbsListView.LayoutParams param = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                80);
        mView.setLayoutParams(param);

        mView.setImageResource(R.drawable.mylogo);
//        if (datas.size() != 0) {
//            String url = datas.get(position);
//            mLog.e("访客图片url:"+url);
//
//
//
//            imageLoader.loadImage(url,new ImageLoadingListener() {
//                @Override
//                public void onLoadingStarted(String s, View view) {
//
//                }
//
//                @Override
//                public void onLoadingFailed(String s, View view, FailReason failReason) {
//
//                }
//
//                @Override
//                public void onLoadingComplete(String s, View view, Bitmap bitmap) {
//                    mView.setBackground(AbImageUtil.bitmapToDrawable(bitmap));
//
//                }
//
//                @Override
//                public void onLoadingCancelled(String s, View view) {
//
//                }
//            });
//
//
//
//        }


        return mView;
    }
}
